home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 5.7 KB | 209 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWWinPro.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifdef FW_PRECOMPILE_BY_LAYER
- #include "FWOS.hpp"
- #endif
-
- #ifdef FW_PRECOMPILE_BY_SUBSYSTEM
- #include "FWWindow.hpp"
- #endif
-
-
- #ifndef FWWINPRO_H
- #include "FWWinPro.h"
- #endif
-
- #if FW_OPENDOC_VERSION >= FW_OPENDOC_DR2
-
- #ifndef FWBARRAY_H
- #include "FWBArray.h"
- #endif
-
- #ifndef FWITEXT_H
- #include "FWIText.h"
- #endif
-
- #ifndef FWWINDOW_H
- #include "FWWindow.h"
- #endif
-
- #ifndef FWITEXT_H
- #include "FWIText.h"
- #endif
-
- // ----- OpenDoc Utilities -----
-
- #ifndef _STDTYPIO_
- #include "StdTypIO.h"
- #endif
-
- #ifndef _STORUTIL_
- #include <StorUtil.h>
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef SOM_ODFrame_xh
- #include <Frame.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- //========================================================================================
- // Runtime Info
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwwindow
- #endif
-
- //========================================================================================
- // class FW_CWindowProperties
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CWindowProperties::FW_CWindowProperties
- //----------------------------------------------------------------------------------------
-
- FW_CWindowProperties::FW_CWindowProperties(Environment* ev)
- {
- PrivInitProperties(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CWindowProperties::~FW_CWindowProperties
- //----------------------------------------------------------------------------------------
-
- FW_CWindowProperties::~FW_CWindowProperties()
- {
- if (fSourceFrame)
- fSourceFrame->Release(somGetGlobalEnvironment());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CWindowProperties::PrivInitProperties
- //----------------------------------------------------------------------------------------
-
- void FW_CWindowProperties::PrivInitProperties(Environment* ev)
- {
- #ifdef FW_BUILD_MAC
- FW_CPoint interiorSize(
- FW_IntToFixed(FW_QDGlobals.screenBits.bounds.right - 64),
- FW_IntToFixed(FW_QDGlobals.screenBits.bounds.bottom - LMGetMBarHeight() - 4 - 4 - 20));
- FW_CPoint position(FW_IntToFixed(4), FW_IntToFixed(LMGetMBarHeight() + 4 + 19));
- fBoundsRect.Set(position.x, position.y, position.x + interiorSize.x, position.y + interiorSize.y);
-
- fMacTitle[0] = 0;
- fMacProcID = FW_CWindow::PrivMacStyleToProcId(ev, FW_kDocumentWindow);
- fMacHasCloseBox = TRUE;
- fMacRefCon = 0;
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- #endif
-
- fWasVisible = TRUE;
- fIsFloating = FALSE;
- fIsRootWindow = TRUE;
- fShouldShowLinks = FALSE;
- fSourceFrame = NULL;
- fIsResizable = TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CWindowProperties::ReadWindowProperties
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_CWindowProperties::ReadWindowProperties(Environment* ev, ODFrame* frame)
- {
- FW_Boolean result = FALSE;
-
- // ----- Initialize the property record -----
- if (fSourceFrame)
- fSourceFrame->Release(somGetGlobalEnvironment());
- PrivInitProperties(ev);
-
- // ----- read -----
- ODStorageUnit* frameSU = frame->GetStorageUnit(ev);
- ODStorageUnit* windowPropsSU = kODNULL;
-
- ODID id = ODGetStrongSURefProp(ev, frameSU, kODPropWindowProperties, kODStrongStorageUnitRef);
- if (id == 0)
- return FALSE;
-
- #if FW_OPENDOC_VERSION >= FW_OPENDOC_DR3
- windowPropsSU = frameSU->GetDraft(ev)->AcquireStorageUnit(ev,id);
- #else
- windowPropsSU = frameSU->GetDraft(ev)->GetStorageUnit(ev,id);
- #endif
-
- if (windowPropsSU)
- {
- ODRect odRect;
- ODGetRectProp(ev, windowPropsSU, kODPropWindowRect, kODRect, &odRect);
- fBoundsRect = odRect;
-
- #ifdef FW_BUILD_MAC
- ODIText* iText = ODGetITextProp(ev, windowPropsSU, kODPropWindowTitle, kODMacIText, NULL);
- if (iText)
- GetITextPString(iText, fMacTitle);
- ::DisposeIText(iText);
-
- fMacProcID = ODGetSShortProp(ev, windowPropsSU, kODPropWindowProcID, kODSShort);
- fMacHasCloseBox = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowHasCloseBox, kODBoolean);
- fMacRefCon = ODGetSLongProp(ev, windowPropsSU, kODPropWindowRefCon, kODSLong);
- #endif
-
- fIsResizable = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsResizable, kODBoolean);
- fWasVisible = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsVisible, kODBoolean);
- fShouldShowLinks = ODGetBooleanProp(ev, windowPropsSU, kODPropShouldShowLinks, kODBoolean);
-
- fIsFloating = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsFloating, kODBoolean);
- fIsRootWindow = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsRootWindow, kODBoolean);
-
- if (windowPropsSU->Exists(ev, kODPropSourceFrame, kODStrongStorageUnitRef, 0))
- {
- ODID id = ODGetStrongSURefProp(ev, windowPropsSU, kODPropSourceFrame, kODStrongStorageUnitRef);
- #if FW_OPENDOC_VERSION >= FW_OPENDOC_DR3
- fSourceFrame = windowPropsSU->GetDraft(ev)->AcquireFrame(ev, id);
- #else
- fSourceFrame = windowPropsSU->GetDraft(ev)->GetFrame(ev, id);
- #endif
- }
-
- windowPropsSU->Release(ev);
-
- result = TRUE;
- }
-
- return result;
- }
-
- #endif
-